#ifndef COUTPUTGENERATOR_H
#define COUTPUTGENERATOR_H

#include <QObject>

#include "src/centry.h"
#include "src/ctextbrowser.h"

class COutputGenerator : public QObject
{
    Q_OBJECT

    QString m_dir;

    QString m_header;
    QMap<int, QString> m_entry;
    QString m_footer;
    QString m_empty; // for empty entry
    QString m_buttons; // buttons for edit and delete
    QString m_start; // header of field's array
    QString m_end; // end of field's array
    QString m_field; // field row
    QString m_startScreen; // start screen with help

    CTextBrowser *m_browser;

    CEntry *m_current;

    void debug(QString msg) const { qDebug() << "[OutGen]\t" + msg; }
    QString createButtons(int, bool need_edit=true);

    QString readFile(QString);

public:
    COutputGenerator(CTextBrowser*, QString filename = QString());

    QString generate(CEntry*, bool);
    QString getEmpty() { return m_header + m_empty + m_footer; }
    QString startScreen() { return m_startScreen; }
    CEntry* current() { return m_current; }
};

#endif // COUTPUTGENERATOR_H
